/// @tags: DynamicSegTree
#include <cctype>
#include <cstdio>

namespace BlueQuantum {

typedef long long ll;

int const N = 1e5 + 5;
ll const M = 1e10 + 5;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

struct Node {
  int ls, rs, sum;
} tr[N * 40];

int n, rt, tot, l, r;
ll ans, pre[N];

inline void pushup(int x) { tr[x].sum = tr[tr[x].ls].sum + tr[tr[x].rs].sum; }

void modify(int &x, ll pos, ll l = -M, ll r = M, int val = 1) {
  if (!x) x = ++tot;
  if (l == r) { return tr[x].sum += val, void(); }
  ll mid = (l + r) >> 1;
  if (pos <= mid) modify(tr[x].ls, pos, l, mid);
  else
    modify(tr[x].rs, pos, mid + 1, r);
  pushup(x);
}

int query(int &x, ll L, ll R, ll l = -M, ll r = M) {
  if (!x) return 0;
  if (L <= l && r <= R) return tr[x].sum;
  ll res = 0, mid = (l + r) >> 1;
  if (L <= mid) res += query(tr[x].ls, L, R, l, mid);
  if (R > mid) res += query(tr[x].rs, L, R, mid + 1, r);
  return res;
}

inline int main() {
  read(n), read(l), read(r);
  for (int i = 1; i <= n; ++i) { read(pre[i]) += pre[i - 1]; }
  modify(rt, 0);
  for (int i = 1; i <= n; ++i) {
    ans += query(rt, pre[i] - r, pre[i] - l);
    modify(rt, pre[i]);
  }
  printf("%lld", ans);
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P5459 [BJOI2016]回转寿司.in", "r", stdin);
  freopen("P5459 [BJOI2016]回转寿司.out", "w", stdout);
#endif
#endif

  return BlueQuantum::main();
}